package org.example.stream;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.stream.Stream;

public class Test {
    public static void main(String[] args) {
       User user =  new User(1,"a",21);
       User user1 =  new User(2,"b",22);
       User user2 =  new User(3,"c",23);
       User user3 =  new User(4,"d",24);
       User user4 =  new User(6,"e",25);
       List<User> list=  Arrays.asList(user,user1,user2,user3,user4);
        list.stream()
                .filter(u-> u.getId()%2 == 0).
                filter(u -> u.getAge()> 23).
                map(u -> u.getName().toUpperCase()).
                sorted(((o1, o2) -> -o1.compareTo(o2))).
                forEach(System.out::println);

    }
}
